<?php

namespace App\Modules\Apicrzs\Http\Controllers\Intake;

use App\Modules\Apicrzs\Http\Controllers\BaseApicrzsController;
use App\Modules\Apicrzs\Services\Water\WaterDeviceService;
use Illuminate\Http\Request;

# 普通用户  设备


class DeviceController extends BaseApicrzsController
{
    public function __construct(WaterDeviceService $service)
    {
        $this->service = $service;
    }

    public function lists(Request $request)
    {
        $result = $this->service->getLists($request->all());

        return $this->sendApiSuccess($result, $this->service->getError());
    }
    public function alllists(Request $request)
    {
        $result = $this->service->alllists($request->all());

        return $this->sendApiSuccess($result, $this->service->getError());
    }
    public function getEquipmentPlan(Request $request)
    {
        $result = $this->service->getEquipmentPlans($request->all());

        return $this->sendApiSuccess($result, $this->service->getError());
    }


    /**
     * 检测设备状态 01
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function getIsOnline(Request $request)
    {
        $result = $this->service->getEquipmentCheckPay($request->all());
        $data = [
            'code' => 0,
            'status' => 200,
            'message' => 'success',
            'data' => $result,
        ];


        return $this->sendApiSuccess($result, $this->service->getError());
    }


}
